<% content_for :page_title do %>
    <%= link_to Spree.t(:stock_transfers), spree.admin_stock_transfers_url %> /
    <%= @stock_transfer.number %>
<% end %>

<% content_for :page_actions do %>
  <%= button_link_to Spree.t(:new_stock_transfer), new_admin_stock_transfer_path, { icon: 'add', class: 'btn-success' } %>
<% end if can? :create, Spree::StockTransfer %>

<fieldset>
  <legend><%= Spree.t(:stock_transfer_name) %></legend>

  <table class="table table-bordered">
    <tr>
      <td width="30%"><strong><%= Spree.t(:created_at) %></strong></td>
      <td><%= @stock_transfer.created_at %></td>
    </tr>
    <% if @stock_transfer.reference.present? %>
      <tr>
        <td><strong><%= Spree.t(:reference) %></strong></td>
        <td><%= @stock_transfer.reference %></td>
      </tr>
    <% end %>
  </table>

  <% if @stock_transfer.source_movements.present? %>
    <fieldset>
      <legend id="stock-location-source">
        <%= Spree.t(:source) %> / <%= @stock_transfer.source_location.name %>
      </legend>
      <%= render partial: 'stock_movements', object: @stock_transfer.source_movements %>
    </fieldset>
  <% end %>

  <% if @stock_transfer.destination_movements.present? %>
    <fieldset>
      <legend id="stock-location-destination">
        <%= Spree.t(:destination) %> / <%= @stock_transfer.destination_location.name %>
      </legend>
      <%= render partial: 'stock_movements', object: @stock_transfer.destination_movements %>
    </fieldset>
  <% end %>

</fieldset>
